﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FineSoft.Models
{
	public class ConfigValue : System.Runtime.Serialization.ISerializable
	{
		public string Name { get; set; }
		public Object Value { get; set; }

		public ConfigValue()
		{
		}

		public string ConfigString
		{
			get
			{
				return this.Name + ":" + this.Value.ConfigsString;
			}
		}

		#region ISerializable 成员

		public ConfigValue(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
		{
			this.Name = info.GetString("Name");
			this.Value = (Object)info.GetValue("Value", System.Type.GetType(info.GetString("ValueType")));
		}

		void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
		{
			info.AddValue("Name", this.Name);
			info.AddValue("ValueType", Value.GetType().GetName());
			info.AddValue("Value", this.Value);

		#endregion
		}
	}
}